package com.example.myapplication;

import android.os.Bundle;
import android.widget.Button;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import android.content.Intent;
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
        // 正确引用ID
        Button buttonUc1 = findViewById(R.id.button);
        Button buttonRelative = findViewById(R.id.button2);
        Button buttonUc3 = findViewById(R.id.button3);
        Button buttonUc4 = findViewById(R.id.button4);
        Button buttonUc5 = findViewById(R.id.button5);


      buttonUc1.setOnClickListener(v -> {
           startActivity(new Intent(MainActivity.this, uc1.class));
       });

        // 新增：跳转到 uc2（相对布局）
        buttonRelative.setOnClickListener(v -> {
            startActivity(new Intent(MainActivity.this, uc2.class));
        });
        buttonUc3.setOnClickListener(v -> {
            startActivity(new Intent(MainActivity.this, uc3.class));
        });

       buttonUc4.setOnClickListener(v -> {
           startActivity(new Intent(MainActivity.this, uc4.class));
       });
        buttonUc5.setOnClickListener(v -> {
            startActivity(new Intent(MainActivity.this, uc5.class));
        });
   }
}


